# Contributor: Jakub Jirutka <jakub@jirutka.cz>
# Maintainer: Jakub Jirutka <jakub@jirutka.cz>
pkgname=pg_top
pkgver=4.0.0
pkgrel=1
pkgdesc="top for PostgreSQL"
url="https://pg_top.gitlab.io"
arch="all"
license="BSD-3-Clause"
makedepends="
	cmake
	libbsd-dev
	linux-headers
	ncurses-dev
	postgresql-dev
	samurai
	"
subpackages="$pkgname-doc"
source="https://gitlab.com/pg_top/pg_top/-/archive/v$pkgver/$pkgname-v$pkgver.tar.gz"
builddir="$srcdir/$pkgname-v$pkgver"
options="!check"  # no tests provided

build() {
	local crossopts=
	if [ "$CBUILD" != "$CHOST" ]; then
		crossopts="-DCMAKE_SYSTEM_NAME=Linux -DCMAKE_HOST_SYSTEM_NAME=Linux"
	fi
	cmake -B build -G Ninja -Wno-dev \
		-DCMAKE_BUILD_TYPE=MinSizeRel \
		-DCMAKE_INSTALL_PREFIX=/usr \
		-DCMAKE_VERBOSE_MAKEFILE=ON \
		$crossopts
	cmake --build build
}

package() {
	DESTDIR="$pkgdir" cmake --install build
}

sha512sums="c372304411f3b74a6c541c94f80a01f4f9cae2a74ab219a163ac8cebc57332601b36195cce79b4cc549dce8a562f59789704b840d20d2bd71c91a6b48facaa5a  pg_top-v4.0.0.tar.gz"
